#include<stdio.h>
int main()
{int m,n,a[12][12]={0},x,y,i,j,sum;
scanf("%d %d",&m,&n);
	for(i=1;i<m+1;i++)
	for(j=1;j<n+1;j++)
		scanf("%d",&a[i][j]);
	scanf("%d %d",&x,&y);
	sum=a[x-1][y-1]+a[x-1][y]+a[x-1][y+1]+a[x][y-1]+a[x][y+1]+a[x+1][y-1]+a[x+1][y]+a[x+1][y+1];
	printf("%d",sum);
	return 0;
	}
